package com.zhiyou.converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;

public class UserConveter implements Converter<String,Date>{
	
	private String pattern=null;
	public String getPattern() {
		return pattern;
	}
	public void setPattern(String pattern) {
		this.pattern = pattern;
	}
	@Override
	public Date convert(String arg0) {
	    SimpleDateFormat sdf=new SimpleDateFormat(pattern);
		sdf.applyPattern(pattern);
		Date date=null;
		try {
			date=sdf.parse(arg0);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return date;
	}

}
